import { RootObject } from "@/model/rootObject"
import { UserInfoModel, RefreshModel } from "@/model/userModel"
import https from "@/utils/https"
import { LoginModel } from "@/views/user-manager/login/model/loginModel"
import { RequestParams, ContentType, Method } from "@/utils/http"

export const loginRequest = (userInfo: RequestParams) => {
  return https(false).request<RootObject<LoginModel>>(
    "user/login",
    Method.POST,
    userInfo,
    ContentType.json
  )
}

export const userInfoRequest = () => {
  return https().request<RootObject<UserInfoModel>>(
    "user/userInfo",
    Method.GET,
    undefined,
    ContentType.form
  )
}

export const getRefresh = (user: any) => {
  return https().request<RefreshModel>(
    "user/getUsers",
    Method.GET,
    user,
    ContentType.form
  )
}
